Skip to content

fix(gate): the scope manifest scan stops once a budget is exceeded unless truncation is accepted (CC-697, refs #781) - #788

Merged
screenleon merged 4 commits into
mainfrom
fix/scope-manifest-early-stop-781
Nov 6, 2026
Merged

screenleon merged 4 commits into
mainfrom
fix/scope-manifest-early-stop-781

Conversation

@screenleon

@screenleon screenleon commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • The scope manifest scan (_gate_scope_expansions_collect_into) stops between sources once a source, symbol, search-match or contract-consumer budget is already exceeded and --accept-scope-truncation is not set. Those counters only grow, so the verdict is already INCOMPLETE and the rest of the scan (about 1 s per source on native Windows) only delays the report (Native Windows: 127 个变更路径的 full-tier gate,scope manifest 耗时 495 秒后因预算超限 INCOMPLETE,派审查员之前已用掉 8 分钟 #781: 495 s for 127 paths).
  • The early stop is recorded in the manifest as truncation.scan_stopped_early: true (present only then; added to core/schema/gate-scope-manifest.schema.json and the generated gate-structural-schemas.json). The INCOMPLETE report reads it from the manifest, says the omitted counts are lower bounds and the expansion list is partial, and says acceptance covers whatever the full scan omits.
  • A run with --accept-scope-truncation scans everything as before and never carries the field.
  • The expansion-entry budget is not used for the early stop: it is only known after de-duplication.
  • Not done (recorded in CC-697): reusing the manifest for the accepting rerun, a time-limit option, the platform-support note, the exit-code wording.

Refs #781 (stays open).

Verification (native Windows)

  • bash tests/shell/test-pr-gate.sh --filter "scope-manifest/": all 9 cases pass, including the existing exact-count overflow case and the new one (which now also asserts status == incomplete, the field present, and the field absent on the accepting run).
  • The structural validator accepts scan_stopped_early: true and rejects false on a real manifest; gate-structural-validator.sh --check and lint-script-domain-inventory pass. test-core-schemas.sh cannot run its jsonschema cases on this host (CLI not installed).

Review (commands/ship.md Steps 2.5 and 3)

  • Step 2.5: one tidy-up (a continuation line), no reusable helper exists.

  • pmctl gate run could not finish: codex returned "Selected model is at capacity" twice, and the claude executor's reviewers were refused the pre-write guard check in a session with no approval surface. No Final verdict exists from the gate.

  • Per-reviewer review with five subagents (critic, qa-tester, architecture-reviewer, security-reviewer, risk-reviewer) on the first commit pair: no block or high finding from any. Actions taken: manifest field instead of a stderr-only note (security, architecture, risk, critic), local flag published with the other results (architecture F2), reworded acceptance guidance (risk). Not taken: passing ACCEPT_SCOPE_TRUNCATION as a parameter (architecture F3, low), adding diff-hunk overflow to the stop condition (critic, a missed optimisation only), variant tests for the source/symbol/contract-consumer terms and a later-source-only overflow (qa-tester, low; the 257-source fixture is too slow on Windows).

  • The second commit (manifest field) was not reviewed again.

  • Permanent test admissions: scope-manifest/overflow-stops-scan-unless-accepted is a new permanent test. It pins behaviour nothing else covers (a scan stopping after the first overflow with the field recorded, and an accepting run still counting both sources: 1 versus 2, without the field), it has a cheap deterministic fixture, and no existing case could assert it without changing its meaning.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ESW7P9wHJRbhxx3v7XyQuq

screenleon and others added 4 commits November 5, 2026 21:09
…less truncation is accepted (CC-697, refs #781)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ESW7P9wHJRbhxx3v7XyQuq
…(CC-697)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ESW7P9wHJRbhxx3v7XyQuq
…can_stopped_early (CC-697, refs #781)

Review round 1 (critic, qa-tester, architecture, security, risk): all five
had no blocking finding; security, architecture and risk each asked for the
lower-bound fact to be in the manifest the user inspects, not only on stderr.
The flag is now a local published with the other scan results, the report
reads it from the manifest, and it says acceptance covers the full scan.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ESW7P9wHJRbhxx3v7XyQuq
… -t (CC-697)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ESW7P9wHJRbhxx3v7XyQuq
@screenleon
screenleon merged commit 0545263 into main Nov 6, 2026
89 checks passed
@screenleon
screenleon deleted the fix/scope-manifest-early-stop-781 branch November 6, 2026 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant